#include "gamehall.h"
#include "ui_gamehall.h"
#include<QPainter>
#include<QIcon>
#include<QPushButton>
#include"selecthall.h"
GameHall::GameHall(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::GameHall)
{
    ui->setupUi(this);
    this->setFixedSize(QSize(1000,800));
    this->setWindowIcon(QIcon(":rec/sheng.png"));
    this->setWindowTitle("贪吃蛇小游戏");
    QPushButton *button_begin = new QPushButton(this);
    button_begin->setText("开始游戏");
    button_begin->move(450,700);
    button_begin->setFont(QFont("华文雅黑",24));
    connect(button_begin,&QPushButton::clicked,this,&GameHall::begin_headle);


}

GameHall::~GameHall()
{
    delete ui;
}

void GameHall::paintEvent(QPaintEvent *event)
{
    //通过画图事件来给窗口增加界面；
    //1:创建画图人；
    (void)event;
    QPainter painter(this);
    //2:创建图片；
    QPixmap pixmap(":rec/R-C.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pixmap);
}

void GameHall::begin_headle()
{
    this->close();
    SelectHall*selecthall = new SelectHall;
    selecthall->show();
}

